var logger = require('../common/config').logger('app');
var staticPage = require('./static');
var user = require('./userRoute');
var driver = require('./driverRoute');
var rent = require('./rentRoute');
var piece = require('./pieceRoute');
var company = require('./CompanyRoute');

module.exports = function (app) {

    /**
     *  user route
     * */
    app.get('/user/login', staticPage.loginPage);
    app.post('/user/login', user.login);

    app.get('/user/register', staticPage.registerPage);
    app.post('/user/register', user.register);

    app.get('/user/center', user.userCenterPage);
    app.post('/user/order', user.findOrderList);

    app.get('/user/resetPassword', user.resetPassword);
    app.post('/user/modify', user.modifyAccount);
    app.post('/upload/:type', user.uploadFile);

    /**
     *  static pages route
     * */
    app.get('/', staticPage.indexPage);

    /**
     *  rent car route
     * */
    app.get('/rent', rent.rentCarPage);
    app.get('/rent/travel', rent.travelPage);
    app.get('/rent/airport', rent.airportPage);
    app.post('/rent/genOrder', rent.generateRentOrder);
    app.post('/order/cancel',rent.cancelOrder);

    /**
     *  driver side
     * */
    app.get('/driver/login', driver.loginPage);
    app.get('/driver/index', driver.driverIndexPage);
    app.post('/driver/login', driver.login);
    app.post('/driver/order', driver.fetchOrder);

    /**
     * piece route
     * */
    app.get('/piece',piece.piecePage);
    app.post('/piece/waitOrder',rent.generateRentOrder);

    /*
        company route
    */
    app.get('/company',company.companyPage);
    app.post('/company/applyAccount',company.applyAccount);
};
